package com.wenli.lt;

/**
 * @author l&t
 * @version 1.0
 * @date 2021/3/17 19:49
 */

import com.wenli.lt.filter.ControllerFilter;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.scheduling.annotation.EnableScheduling;

/**
 *  启动类代码
 */
@SpringBootApplication
@EnableScheduling
@EnableAspectJAutoProxy//开启AspectJ注解
@MapperScan("com.wenli.lt.mapper") // 注解方式设置mapper扫描路径
public class Application {



    public static void main(String[] args) {

        SpringApplication.run(Application.class);
    }

    @Bean
    public FilterRegistrationBean testFilterRegistration() {

        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(new ControllerFilter());
        registration.addUrlPatterns("/*");
        registration.addInitParameter("paramName", "paramValue");
        registration.setName("controllerFilter");
        registration.setOrder(1);
        return registration;
    }

}
